//
//  EPMUnloginAddressView.m
//  myXianfeng
//
//  Created by 马继鵬 on 17/4/26.
//  Copyright © 2017年 EPM. All rights reserved.
//

#import "EPMUnloginAddressView.h"
#import "EPMViewController.h"
#import "EPMAddressViewController.h"

@interface EPMUnloginAddressView()

@end
@implementation EPMUnloginAddressView

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]){
        [self setupUI];
    }
    return self;
}

#pragma mark - UI设置 -

- (void) setupUI{
    UILabel* label = [[UILabel alloc]init];
    [self addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self);
    }];
    label.textAlignment = NSTextAlignmentCenter;
    label.textColor = [UIColor darkGrayColor];
    label.font = [UIFont systemFontOfSize:13];
    label.text = @"抱歉当前地址暂未开通服务,敬请期待";
    
    UILabel* localLablel = [UILabel new];
    localLablel.font = [UIFont fontWithName:@"iconfont" size:100];
    localLablel.text = @"\U0000e89d";
    localLablel.textColor = [UIColor lightGrayColor];
    [localLablel sizeToFit];
    [self addSubview:localLablel];
    [localLablel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.bottom.equalTo(label.mas_top).offset(-7);
    }];
    
    
    UIButton* btn = [[UIButton alloc]init];
    [self addSubview:btn];
    [btn setTitle:@"切换地址" forState:UIControlStateNormal];
    [btn setTitleColor:appColor forState:UIControlStateNormal];
    [btn.layer setMasksToBounds:YES];
    [btn.layer setCornerRadius:5.0];
    [btn.layer setBorderWidth:1.0];
    btn.layer.borderColor = appColor.CGColor;
    
    [btn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.equalTo(label.mas_bottom).offset(7);
        make.width.mas_equalTo(140);
        make.height.mas_equalTo(30);
    }];
    
    [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
}

- (void)btnClick:(id)sender{
    EPMAddressViewController* VC = [[EPMAddressViewController alloc]init];
    [self.viewController.navigationController pushViewController:VC animated:YES];
}
@end
